<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html">

    <body>

        <ui:composition template="../templates/default3.xhtml">         

            <ui:define name="content">

                <h:form id="updateLead" binding="#{leadManagerBean.loadUpdateLead}">

                    <p:messages/>
                    <p:panel header="Lead information" id="updateLead0">
                        <font class="fieldNote">*- Mandatory Field<br/><br/></font>
                        <table>
                            <tr>
                                <td width ="80px">Employee:</td>
                                <td width="200px"> <h:outputText  id="userId" value="#{leadManagerBean.userId}"> 
                                    </h:outputText> 

                                </td>
                            </tr>
                            <tr>
                                <td>Email:</td>
                                <td width="200px"> 
                                    <p:inputText id="email" value="#{leadManagerBean.email}" required="true" requiredMessage="Email Address Required" validatorMessage="Invalid Email Address Format"> 
                                        <f:validateRegex pattern="^(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)|([A-Za-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-zA-Z]{2,6}$" />
                                    </p:inputText>
                                    <font class="fieldNote">*</font>
                                </td>

                                <td width="80px">Company:</td>
                                <td> 
                                    <p:inputText id="company"  value="#{leadManagerBean.company}" required="true" requiredMessage="Company Required">                                       
                                    </p:inputText> 
                                    <font class="fieldNote">*</font>
                                </td>


                            </tr>      
                            <tr>
                                <td>First name:</td>
                                <td> 
                                    <p:inputText id="fname" value="#{leadManagerBean.firstName}" required="true" requiredMessage="First Name Required" > 
                                    </p:inputText> 
                                    <font class="fieldNote">*</font> 
                                </td>

                                <td>Title:</td>
                                <td>                                                                                
                                    <p:inputText id="title" value="#{leadManagerBean.title}" required="true" requiredMessage="Title Required" >
                                    </p:inputText> 
                                    <font class="fieldNote">*</font> 
                                </td>

                            </tr>
                            <tr>
                                <td>Last name:</td>
                                <td> 
                                    <p:inputText id="lname" value="#{leadManagerBean.lastName}" required="true" requiredMessage="Last Name Required"> 
                                    </p:inputText> 
                                    <font class="fieldNote">*</font> 
                                </td>

                                <td>Status:</td>
                                <td>
                                    <h:selectOneMenu id="status" value="#{leadManagerBean.status}">
                                        <f:selectItem id="Open" itemLabel="Open" itemValue="Open" />
                                        <f:selectItem id="Contacted" itemLabel="Contacted" itemValue="Contacted" />
                                        <f:selectItem id="Converted" itemLabel="Converted" itemValue="Converted" />
                                        <f:selectItem id="Rejected" itemLabel="Rejected" itemValue="Rejected" />
                                    </h:selectOneMenu>
                                    <font class="fieldNote">*</font> 
                                </td>
                            </tr>


                            <tr>
                                <td>Telephone:</td>
                                <td>                                                                                
                                    <p:inputText  id="phone" label="Telephone" value="#{leadManagerBean.phone}"  required="true" requiredMessage="Telephone Required" validatorMessage="Telephone Must Have a Minimum of 8 Digits">
                                        <f:validateLength minimum="8"/>
                                    </p:inputText> 
                                    <font class="fieldNote">* Min. 8</font>
                                </td>

                                <td>Industry:</td>
                                <td>
                                    <h:selectOneMenu id="industry" value="#{leadManagerBean.industry}">
                                        <f:selectItem id="HC" itemLabel="Health care" itemValue="Health care" />
                                        <f:selectItem id="Hospitality" itemLabel="Hospitality" itemValue="Hospitality" />
                                        <f:selectItem id="Entertainment" itemLabel="Entertainment" itemValue="Entertainment" />
                                        <f:selectItem id="Recreation" itemLabel="Recreation" itemValue="Recreation" />
                                        <f:selectItem id="Retail" itemLabel="Retail" itemValue="Retail" />
                                        <f:selectItem id="FB" itemLabel="Food and Beverage" itemValue="Food and Beverage" />
                                    </h:selectOneMenu>
                                    <font class="fieldNote">*</font> 
                                </td>

                                <td>
                                    <p:commandButton id="btnViewLeadInquiries" value="View Inquiries" actionListener="#{salesInquiryManagerBean.viewInquiries}" 
                                                     ajax="true" update="updateLead" />
                                </td>

                            </tr>

                        </table>

                    </p:panel>
                    <p:panel header="Company Address (Optional)" id="updateLead2">
                        <table>

                            <tr >
                                <td width ="80px" valign="top" > Street:</td>
                                <td width="200px" valign="top"> 
                                    <p:inputTextarea id="street" style="width:160px;height:60px;" maxHeight="60" effectDuration="400" value="#{leadManagerBean.street}">
                                    </p:inputTextarea> 

                                </td>
                                <td width="80px">City: <br/><br/> Country: </td>
                                <td width="200px">
                                    <p:inputText  id="city" value="#{leadManagerBean.city}">
                                    </p:inputText> 
                                    <br/><br/>
                                    <p:inputText id="country" value="#{leadManagerBean.country}">
                                    </p:inputText> 
                                </td>


                            </tr>
                            <tr >
                                <td valign ="top" >Postal: </td>
                                <td width="200px" valign ="top"> 
                                    <p:inputText label="Postal" id="postal" value="#{leadManagerBean.postal}" validatorMessage="Postal Code Must Have a Minimum of 4 Digits and Maximum of 8 Digits">
                                        <f:validateLength minimum="4" maximum="11"/>
                                    </p:inputText> 
                                    <br/>
                                    <font class="fieldNote">* Min. 4 , Max. 11</font> 
                                </td>




                            </tr>

                        </table>
                    </p:panel>
                    <p:panel header="Remark (Optional) " id="updateLead3">
                        <table class="panel">
                            <tr>
                                <td width ="80" valign="top" > Description:</td>
                                <td width="200" > 
                                    <p:inputTextarea id="description" style="width:160px;height:80px;" maxHeight="80" effectDuration="400" value="#{leadManagerBean.description}">

                                    </p:inputTextarea> 

                                </td>

                                <td width="80">Annual revenue: <br/><br/> No. of Employee:</td>
                                <td width="200">
                                    <p:inputText  label="Anuual Revenue" id="revenue" value="#{leadManagerBean.revenue}">

                                    </p:inputText> 
                                    <br/><br/>
                                    <p:inputText label="No. Of Employee" id="no_emp" value="#{leadManagerBean.numEmployee}">

                                    </p:inputText> 
                                </td>



                            </tr>

                            <tr>
                                <td colspan="4" class="btn">
                                	<hr/><p:commandButton id="btnDone" value="Done" actionListener="#{leadManagerBean.doneUpdate}" ajax="true" update="updateLead" />                                
                                    </td>
                            </tr>
                        </table>
                    </p:panel>


                </h:form>
            </ui:define>        

        </ui:composition>

    </body>

</html>
